(ns conducta 
 (:use conducta.ui conducta.ui.swing conducta.login-sample conducta.bdd))

(import '(org.fest.swing.fixture FrameFixture))
(import '(com.foo MyFrame))

(def frameFixture)

;; set up the frame fixture
(defn FESTTest-setUp [_] 
   (def frameFixture (FrameFixture. (MyFrame.)))
   (.show frameFixture)
   
   (def username (text frameFixture "username"))
   (def role (combo frameFixture "selector"))
   (def password (text frameFixture "password"))
   (def signin (button frameFixture "signInButton"))
   (def cancel (button frameFixture "cancelButton"))
)

;;  Actual tests
(defn FESTTest-testSubmitEnabledOnCredentials [_]  
  ;; TODO: Change to using a lazy seq and evaluate
  (println)
  (println (get ^#'Enter-credentials-submit-enabled-scenario :doc))
  (Enter-credentials-submit-enabled-scenario username password role signin)
)

(defn FESTTest-testDisabledOnClearingText [_] 
  (println)
  (println (get ^#'Login-button-disabled-on-clearing-scenario :doc))
  (Login-button-disabled-on-clearing-scenario 
    username password signin)
)

(defn FESTTest-testCancelEnablement [_] 
  (println)
  (println (get ^#'User-cancels-login-scenario :doc))
  (User-cancels-login-scenario username password cancel)
)

;; Other GUI tests ... Test domain-agnostic GUI things: tab traversal order, 
;; resizing, etc.

;; clean-up code
(defn FESTTest-tearDown [_] (.cleanUp frameFixture))
